package com.lam.framework.operLog.enums;

import com.lam.framework.operLog.model.Business;

/**
 * 业务操作类型
 * 
 * @author lam
 */
public enum BusinessType implements Business{
	

	/** 新增 */
	QUERY("query", "查询"),
	
	/** 唯一检查 */
	CHECK_UNIQUE("check_unique", "唯一检查"),
	
	/** 新增 */
	INSERT("insert", "新增"),

	/** 修改 */
	UPDATE("update", "修改"),

	/** 删除 */
	DELETE("delete", "删除"),

	/** 导入 */
	IMPORT("import", "导入"),

	/** 导出 */
	EXPORT("export", "导出"),
	
	/** 上传 */
	UPLOAD("upload", "上传"),
	/** 下载 */
	DOWNLOAD("download", "下载"),
	
	/** 登录验证码(字符) */
	LOGIN_CAPTCHA_CODE("login_captcha_code", "登录验证码(字符)"),
	/** 登录验证码(图形) */
	LOGIN_CAPTCHA_IMG("login_captcha_img", "登录验证码(图形)"),
	/** 登录系统 */
	LOGIN_IN("login_in", "登录系统"),
	/** 退出登录 */
	LOGIN_OUT("login_out", "退出登录"),
	
	/** 其它 */
	OTHER("other", "其他"),
	;
	
	private String type;
	private String businessName;
	
	private BusinessType(String type, String businessName) {
		this.type = type;
		this.businessName = businessName;
	}
	
	public static BusinessType valueFrom(String type) {
		for (BusinessType businessType : values()) {
			if(businessType.getType().equalsIgnoreCase(type)) {
				return businessType;
			}
		}
		return null;
	}
	
	public String getType() {
		return type;
	}
	public String getBusinessName() {
		return businessName;
	}
	
}
